package cn.sdormitory.controller.canteen;

import cn.sdormitory.canteen.dao.FoodOrderDao;
import cn.sdormitory.canteen.service.FoodOrderService;
import cn.sdormitory.canteen.vo.FoodGoodsCheckVO;
import cn.sdormitory.canteen.vo.FoodOrderVO;
import cn.sdormitory.canteen.vo.FoodSupplierVO;
import cn.sdormitory.common.api.CommonPage;
import cn.sdormitory.common.api.CommonResult;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@Api(tags = "food-order=> 食品订单操作")
@RequestMapping("/food/order")
public class FoodOrderController {

    @Autowired
    private FoodOrderService foodOrderService;

    @ApiOperation("getOrderPageList => 查询订单")
    @PostMapping(value = "/getOrderPageList")
    public CommonResult<CommonPage<FoodOrderVO>> getOrderPageList(@RequestBody FoodOrderVO vo){
        CommonPage<FoodOrderVO> pageList =  foodOrderService.getPage(vo);
        return CommonResult.success(pageList);
    }


    @ApiOperation("getOrderPageList => 查询订单商品")
    @GetMapping(value = "/getOrdeGoodsrPageList")
    public CommonResult<List<FoodGoodsCheckVO>> getOrdeGoodsrPageList(@RequestParam String orderNo){
        List<FoodGoodsCheckVO> list =  foodOrderService.getGoodsCheckListByOrderNo(orderNo);
        return CommonResult.success(list);
    }

}
